<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


//$pop3 = pop3_open("localhost", "110");
//if (!$pop3) {
//    printf("[ERROR] Failed to connect to localhost<BR>\n");
//    return 0;
//}
//
//if (!pop3_user($pop3, "unk")) {
//    printf("[ERROR] Username failed!<BR>\n");
//    return 0;
//}
//
//if (!pop3_pass($pop3, "secret")) {
//    printf("[ERROR] PASS failed!<BR>\n");
//    return 0;
//}
//
//$articles = pop3_list($pop3);
//if (!$articles) {
//    printf("[ERROR] LIST failed!<BR>\n");
//    return 0;
//}
//
//for ($i = 1; $i < $articles ["count"] + 1; $i++) {
//    printf("i=$i<BR>\n");
//    $data = pop3_retr($pop3, $i);
//    if (!$data) {
//        printf("data goes wrong on '$i'<BR>\n");
//        return 0;
//    }
//
//    for ($j = 0; $j < $data["count"]; $j++) {
//        printf("$data[$j]<BR>\n");
//    }
//}

require_once '../EmailServer.php';
$emailServer = new EmailServer();
//$smtp = $emailServer->smtp_open('localhost', '25');
//echo $emailServer->smtp_helo($smtp);
//echo $emailServer->smtp_ehlo($smtp);
//echo $emailServer->smtp_mail_from($smtp, 'moacir@webmail.com');
//echo $emailServer->smtp_rcpt_to($smtp, 'xeidejuizo@webmail.com');
//echo $emailServer->smtp_data($smtp,'asdfkjgasdjfgsdfjasdaf', 'sdafkljlhaksdjfhsdkjfh ksdjhaf ksahdfkjhsadk fkjsdhf ksdhfkj asdkfjhaslkjdfhlkasdhf');
//echo $emailServer->smtp_quit($smtp);


$conn = $emailServer->imapOpen("administrador@webmail.com", "d4j10h8i9");
$teste = imap_list($conn, "{webmail.com}", "*");
$enviado = imap_mail("xeidejuizo@webmail.com", "sdafkjsdflh", "asddljkffh sksadfh skdfsdhfj sdjkf hsh\fjklasdhdf");
$list = $emailServer->listEmailsImap($conn, "administrador@webmail.com");
//$listSend = $emailServer->listSendedEmailsImap($conn, "administrador@webmail.com");
//$listDel = $emailServer->listDeletedEmailsImap($conn, "administrador@webmail.com");
//$email = $emailServer->obterInfoEmail($conn, 6);
//$email2 = $emailServer->obterConteudoEmail($conn, 6);
//$teste = $emailServer->deletarMensagem($conn, 6);

//$pop3 = $emailServer->pop3_open("localhost", 110);
//$emailServer->pop3_user($pop3, "administrador@webmail.com");
//$emailServer->pop3_pass($pop3, "d4j10h8i9");
//$email = $emailServer->pop3_list($pop3);
//$email2 = $emailServer->pop3_retr($pop3,4);
//$emailServer->pop3_quit($pop3);

//para o envio em formato HTML
//$headers = "MIME-Version: 1.0";
//$headers .= "Content-type: text/html;charset=iso-8859-1";
//
////endereço do remitente
//$headers .= "From: administrador <administrador@webmail.com>";
//
////endereço de resposta, se queremos que seja diferente a do remitente
//$headers .= "Reply-To: administrador@webmail.com";
//
//
//echo mail("xeidejuizo@webmail.com", "akjsdfhlkasdhf", "asljdkfhlkjsfh kfhskd fksdfshfdkjs dfhksdh",$headers);

?>
